-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(colorwheel): S2 migration #3390
base: spectrum-two
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 87b66e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🚀 Deployed on https://pr-3390--spectrum-css.netlify.app |
File metricsSummaryTotal size: 1.42 MB* Table reports on changes to a package's main file.
colorwheel
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions for you, as usual!
- I wonder if we need to refactor the
color-wheel-width
andcolor-wheel-minimum-width
tokens from our custom tokens/dist. Those values change based on the platform (desktop/mobile), but the designs don't say anything about any size changes between desktop and mobile. In other components, they have noted the size differences. It might be something worth checking with design on. 🤷♀️ - Do we need to adjust
.spectrum-ColorWheel-border
at all so that our border is actually transparent, against the color wheel, instead of outside of the color wheel? I'm not sure if the clip path is the right place, but maybe that custom property needs some tweaking? I think S2 would be the place to fix this! (because it's also not like that inmain
, but looking at S1 designs, it should have been).
Ours (effectively, has a gray border):
In Figma (where the border is "on top" of the color wheel):
Happy to pair on any of my comments if two heads are better than one! 👍
I started a thread in the implementations channel about the first question — I'll go ahead and run with design's preference.
|
eaf2611
to
3a12421
Compare
99a6ad6
to
f3be898
Compare
cdb180d
to
27d01df
Compare
7ce5746
to
7af66a2
Compare
9cb357e
to
70603e0
Compare
c93daf7
to
e393c32
Compare
a984eb6
to
61d7526
Compare
56c6806
to
793571c
Compare
1f3d572
to
eb8c57f
Compare
eb8c57f
to
2454e32
Compare
db2a5dd
to
f34473b
Compare
1bfefa5
to
ee52db2
Compare
f34473b
to
cf46c2b
Compare
ee52db2
to
02a3f15
Compare
components/colorwheel/index.css
Outdated
--spectrum-colorwheel-height: var(--mod-colorwheel-height, var(--spectrum-color-wheel-width)); | ||
--spectrum-colorwheel-fill-color-disabled: var(--mod-colorwheel-fill-color-disabled, var(--spectrum-disabled-background-color)); | ||
--spectrum-colorwheel-border-color: var(--spectrum-transparent-black-300); | ||
--spectrum-colorwheel-colorarea-margin: var(--spectrum-color-wheel-color-area-margin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed while inspecting that the way we're using this colorarea margin is not how design has it defined on the specs. I don't think there is a way for us to use the token properly, as it appears to be relying on circle based calculations by the implementation. If I change --mod-colorarea-height
and --mod-colorarea-width
from 80px
to 100%
:
I'm wondering if we should even be setting this margin, if we can't calculate the actual value in CSS. Does this token value just need to be used when calculating the size of the color area? That "With color area" section of the docs is a little confusing. Perhaps this needs more documentation too. I don't see a SWC example with the color area within the color wheel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch! I don't think we need to — I removed the custom property and the declaration and no difference is made in how it's displayed. It's positioning is controlled by...
.spectrum-ColorWheel-colorarea-container {
block-size: auto;
inline-size: 100%;
display: flex;
align-items: center;
justify-content: center;
}
...and the margin has no impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to just document that the --spectrum-color-wheel-color-area-margin
token used for that margin should be factored in by the implementation when calculating the size of the color area. Otherwise it could easily be forgotten about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment above the .spectrum-ColorWheel-colorarea-container
class in e1331f explaining the token (as it had previously been applied there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was afraid this would happen — should we consider removing and provide design with the feedback that it's not possible at the moment? @marissahuysentruyt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the styles here so that they're a bit more stable and based on the width of the inner, colorarea container which resolves the issue in large
but causes the medium
size to display within the interior of the color wheel instead of on top of the interior edge: 35403c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All sorted thanks to @marissahuysentruyt ✨🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"--mod-colorwheel-height", | ||
"--mod-colorwheel-min-width", | ||
"--mod-colorwheel-min-inline-size", | ||
"--mod-colorwheel-path", | ||
"--mod-colorwheel-path-borders", | ||
"--mod-colorwheel-track-width", | ||
"--mod-colorwheel-width" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still be shipping height and width mods? I see they don't really work on their own in CSS in prod, but I do see that the size of the color wheel should be customizable (https://opensource.adobe.com/spectrum-web-components/components/color-wheel/#sized).
Is there any way to allow a custom sizing example or are we excluding this because we'd need to dynamically calculate the clip-path? Are the clip path calculations not possible with CSS, or is that something that veers too far into implementation to do in our JS? Alternatively, I wonder if we could have a differently sized version in docs/VRT that shows that this still works, even if it's a hardcoded clip path?
It does seem like the implementation requirement for clip path calculation needs to be added to the component Docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure — the React docs allow for the same dimensions we're seeing here (they link here) and the token that's being shipped provides the same dimensions: https://github.com/adobe/spectrum-tokens/blob/93614f4c98b5bc8ca1c017934ddfc456699a30c7/packages/tokens/src/layout-component.json#L4654
![image](https://private-user-images.githubusercontent.com/445732/411793003-5eedc572-4285-4a1f-bb12-2531cde1d32f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDUxNjcsIm5iZiI6MTczOTM0NDg2NywicGF0aCI6Ii80NDU3MzIvNDExNzkzMDAzLTVlZWRjNTcyLTQyODUtNGExZi1iYjEyLTI1MzFjZGUxZDMyZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzIxMDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ZDFlODk5NTM0ODE2MjU5ZTg3ZmJiOTkxZDEyYjYwNjE0YWJkODVmM2RkNzcwZjgzMjQ5NzAyYzNiOWUzYmVkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Y-cO-B2nIiXppHFOZl-H4APSLaOie2WnYcsoZJDPta0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the default sizes, but the size can still be customized (as longer as it's greater than or equal to the minimum size), as mentioned in the guideline. I don't think we necessarily need to generate the clip-path calculation at this time.
Mods: There should still be a mod wherever --spectrum-colorwheel-width
and --spectrum-colorwheel-height
are used. Unless there was some reason you were getting rid of them; it's especially important when the size of the color slider is being changed since there is other CSS calculating off these values. Also what about --mod-colorwheel-track-width
and should there be a --mod-colorwheel-border-width
?
Also, I see you renamed min-width to min-inline-size; should the same logical property renaming be done to the width and height tokens to be consistent?
Docs: Could you add something about the implementation requirement for clip path calculation when changing the size?
New custom sizing story?: What if we add a custom sizing story at 300x300? We can use the mod for the clip path with the value being generated in SWC's sizing example. The docs about the clip path calculation could be included in the story description here. This would help ensure in our VRTs that this use case is still working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs: Speaking of the "With color area" section of the docs, it looks like some of the existing docs are incorrect. I see mention of a couple classes that I think were meant to reference a custom property instead. See ".spectrum-colorwheel-colorarea-container-size", ".spectrum-color-wheel-color-area-margin", ".spectrum-colorwheel-path", etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran through and cleaned these up — some are classes, some are custom properties and some have been removed altogether. ✨
1dce4dd
to
71e76e1
Compare
a604c1d
to
4afa4a9
Compare
09e6366
to
c5ef99c
Compare
dee81f5
to
ce2f3e0
Compare
- chore(colorwheel): update property name - chore(colorwheel): wip inset borders - chore(colorwheel): fix lint violations - chore(colorwheel): move mod declarations - chore(colorwheel): drop unused property + update metadata - chore(colorwheel): remove underlying border node + class - chore(colorwheel): remove unused property - fix(colorwheel): add missing mod - fix(colorwheel): comments for updated before spacing/positioning - fix(colorwheel): adopt proper token for border opacity - fix(colorwheel): remove inset border on disabled state - fix(colorwheel): remove global token reference - chore(colorwheel): highlight removed/added mods - chore(colorwheel): update copyright year - chore(colorwheel): add color loupe to default story - fix(colorwheel): correct WHC disabled background color value - chore(colorwheel): update test heading - fix(colorwheel): typos - chore(colorwheel): update token usage - chore(colorwheel): add without loupe test - chore(colorwheel): restore WHC styles - chore(colorwheel): move isWithColorLoupe property - fix(colorwheel): whc disabled background - fix(colorwheel): improve interior border styles - fix(colorwheel): token/classnames in story; remove unnecessary margin - chore(colorwheel): fix inset borders + improve comments - chore(colorwheel): update changeset
c5ef99c
to
2a52b0c
Compare
Description
CSS-1020
This change migrates the colorwheel component to S2. It adds the
--spectrum-colorwheel-border-color-rgb
and--spectrum-colorwheel-border-opacity
custom properties. It updates--spectrum-colorwheel-border-color
to leverage these tokens in anrgba(...)
function.How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
colorwheel
component.Regression testing
Validate:
To-do list